<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\ResourceCollection;

class NotifyCollection extends ResourceCollection
{
    /**
     * Transform the resource collection into an array.
     *
     * @param  \Illuminate\Http\Request $request
     * @return array
     */
    public function toArray($request)
    {
        return parent::toArray($request);
    }

    public function with($request)
    {
        return [
            //广播消息
            'allnotice' => new BannerCollection(
                \App\Banner::where('type', 1)
                    ->where('is_show',1)
                    ->orderBy('created_at', 'desc')
                    ->limit(2)
                    ->get()),
        ];
    }
}
